//#define _CRTDBG_MAP_ALLOC
#include "StdAfx.h"
#include "Video.h"
//#define _CRTDBG_MAP_ALLOC

Video::Video(void)
{
    this->capture=0;
}
//void Video::setFileName(string fileName)
void Video::setFileName(char* fileName)
{
	this->fileName = fileName;
}

string Video::getFileName()
{
	return this->fileName;
}
//void Video::captureFromFile(string fileName)
void Video::captureFromFile(char* fileName)
{
   this->capture = cvCaptureFromFile(fileName);//fileName.c_str()
}
void Video::captureFromCAM(int camNumber)
{
    printf("CamNumber :%d\n",camNumber);
    //capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 );
    capture = cvCaptureFromCAM(camNumber);
   // capture =cvCreateFileCapture(0);
   //capture =cvCreateFileCapture("http:////128.97.43.214");

}
IplImage* Video::queryFrame()
{
    if( capture )
    {
        IplImage* queryFrame = cvQueryFrame(capture);
        if(queryFrame!=0)
        {
            return cvCloneImage(queryFrame);
            //return queryFrame;
        }

    }
    return 0;
}
Video::~Video(void)
{
//    delete fileName;
    cvReleaseCapture( &capture );
}
